﻿@model AirApplication.Models.LoginModel
@{  AjaxOptions ajaxOptsCode = new AjaxOptions
    {
        HttpMethod = "post",
        OnComplete = "completedAjaxRequestFor",
        OnBegin ="onbeginCode",
    };
    
}

    <!-- ## Panel Content  -->
    <script type="text/javascript">

        function completedAjaxRequestFor(obj) {

            var returnObj = eval('(' + obj.responseText + ')');

            if (returnObj.Status == "success") {
                $(".contentFor").html("");
                makeSuccessHighlightFor("Vui lòng check mail, chúng tôi đã gởi thông tin đăng nhập vào Email của bạn");
            } else {
                makeErrorHighlightFor(returnObj.Message);
            }

            $(".Spancode").html("");
            return false;
        }

        function makeErrorHighlightFor(messageStr) {
            var $highlight = $("<div style='padding: 0.7em; margin-bottom:5px; width: inherit;'><p><span class='ui-icon ui-icon-alert' style='float: left; margin-right: .3em;'></span><strong>Alert: </strong>" + messageStr + "</p></div>");
            $highlight.addClass("ui-state-highlight ui-corner-all");
            $highlight.prependTo(".warning-areaFor");
            $highlight.delay(4000).fadeOut(500);
        }

        function makeSuccessHighlightFor(messageStr) {
            var $highlight = $("<div style='padding: 0.7em; margin-bottom:5px; width: inherit;'><p><span class='ui-icon ui-icon-info' style='float: left; margin-right: .3em;'></span><strong>Success: </strong>" + messageStr + "</p></div>");
            $highlight.addClass("ui-state-highlight ui-corner-all");
            $highlight.prependTo(".contentFor");
            //$highlight.delay(4000).fadeOut(500);
        }

        function onbeginCode() {
            $(".Spancode").html("Đang load, vui lòng đợi");
        }

    </script>
 <div class="contentFor">
    @using (Ajax.BeginForm("ForgetPassword", "Account", null, ajaxOptsCode, new { enctype = "multipart/form-data" }))
    {
        <div class="warning-areaFor">
        </div>
        <div class="Spancode">
        </div>
        <div>
            @Html.TextBoxFor(model => model.name, new { @placeholder = "Email" })
        </div>
        <div>
            <input type="submit" class="button-blue submit" value="Login" />
        </div>
    }
    <!-- ## / Panel Content  -->
</div>
